package Demo;

import java.util.HashMap;
import java.util.Scanner;

public class Test_Pome {
    public static void main(String[] args) {
        Pome p1 = new Pome("登高","杜甫","万里悲秋长做客，百年多病独登台。");
        Pome p2 = new Pome("静夜思","李白","举头望明月，低头思故乡。");
        Pome p3 = new Pome("我住长江头","李之仪","日日思君不见君，共饮长江水");

        HashMap map = new HashMap();

        map.put(p1.getTitle(),p1.getContent());
        map.put(p2.getTitle(),p2.getContent());
        map.put(p3.getTitle(),p3.getContent());

        System.out.println("请输入你的诗句的名字：");
        Scanner input = new Scanner(System.in);
        boolean tem = true;
        while ((tem)) {
            String title = input.next();

            if (map.containsKey(title)) {
                String content = (String) map.get(title);
                System.out.println("诗句的内容是："+content);
                tem = false;

            } else {
                System.out.println("没有符合的诗句！");
            }
        }
    }
}
